package com.yueka.service.Impl;

import com.yueka.mapper.InstrumentCategoryMapper;
import com.yueka.pojo.entity.instrument_category.InstrumentCategory;
import com.yueka.service.InstrumentCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.time.LocalDateTime;
import java.util.List;

@Service
public class InstrumentCategoryServiceImpl implements InstrumentCategoryService {
    @Autowired
    private InstrumentCategoryMapper instrumentCategoryMapper;


    @Override
    public Integer delete(Integer[] ids) {
        return instrumentCategoryMapper.delete(ids);
    }

    @Override
    public Integer update(InstrumentCategory instrumentCategory) {
        instrumentCategory.setUpdateTime(LocalDateTime.now());
        return instrumentCategoryMapper.update(instrumentCategory);
    }

    @Override
    public List<InstrumentCategory> getAll() {
        return instrumentCategoryMapper.list();
    }

    @Override
    public Integer insert(InstrumentCategory instrumentCategory) {
        instrumentCategory.setCreateTime(LocalDateTime.now());
        instrumentCategory.setUpdateTime(LocalDateTime.now());
        return instrumentCategoryMapper.insert(instrumentCategory);
    }


}
